<%@page import="java.util.Collections"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>通知管理</title>
</head>
<body>
	<%@include file="teacher_head.jsp"%>
	<div class="container">
		<div class="row">
			<div class="form-inline">
				<img src="../../resource/teacher.jpg" class="img-rounded imgstyle" />
				<h1>
					<strong>上机考试管理</strong>
				</h1>
			</div>
		</div>
	</div>
	<br>
	<div class="container divcontainerstyle">
		<h2>新增通知消息</h2>
		<form action="../../servlet_addmeessage_teacher">
			<div class="form-inline">
				<input type="text" name="message" placeholder="通知消息内容"
					class="form-control">
				<button type="submit"
					class="btn btn-primary btn-sm glyphicon glyphicon-plus"
					style="display: inline;">添加</button>
			</div>
		</form>
	</div>
	<br>

	<div class="container">
		<h2>
			<strong>已有通知消息</strong>
		</h2>
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<td>通知内容</td>
					<td>删除</td>
				</tr>
			</thead>
			<tbody>

				<%
					if (application.getAttribute("message") != null) {
						@SuppressWarnings("unchecked")
						List<String> messagelist = (List<String>) application.getAttribute("message");
						int index = 0;
						for (String message : messagelist) {
				%>
				<tr>
					<td><%=message%></td>
					<td><a href="../../servlet_deletemessage_teacher?id=<%=index++%>"
						class="btn btn-default btn-sm glyphicon glyphicon-remove">删除</a></td>
				</tr>
				<%
					}
					}
				%>

				<!-- <tr>
					<td>佩奇快去学习，明天要考试啦！</td>
					<td><a href=""
						class="btn btn-default btn-sm glyphicon glyphicon-remove">删除</a></td>
				</tr> -->
			</tbody>
		</table>
	</div>
</body>
</html>